New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ai-reduce

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-reduce

Reduce for async iterables.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

ai-reduce

Travis Build Status NPM downloads

Reduce for async iterables.

The reduce() method applies a function against an accumulator and each element in the array (from left to right) to reduce it to a single value.

Async iterable fun

This module is part of Async iterable fun, a complete toolset of modules to work with async iterables.

Usage

description of the example

const aiReduce = require("ai-reduce");

console.log({ aiReduce });

This will output

API

index

The reduce() method applies a function against an accumulator and each element in the async iterable to reduce it to a single promise.

Parameters

  • reducer Function Function to execute on each element in the async iterable, taking four arguments:
           accumulator - The accumulator accumulates the callback's return values; it is
             the accumulated value previously returned in the last invocation of the
             callback, or initialValue, if supplied (see below).

           currentValue - The current element being processed in the async iterable.

           currentIndex - The index of the current element being processed in the async
             iterable. Starts at index 0, if an initialValue is provided, and at index 1
             otherwise.

           data - The async iterable reduce was called upon.
  • accumulator any Value to use as the first argument to the first call of the callback. If no initial value is supplied, the first element in the async iterable will be used. Calling reduce on an empty async iterable without an initial value is an error.
  • data AsyncIterable The async iterable to reduce

Returns Promise The promise value that results from the reduction.

Install

With npm installed, run

npm install --save ai-reduce

See Also

License

MIT

FAQs

Package last updated on 18 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc